var width,height;
width=jQuery(window).width();
height=jQuery(window).height();
jQuery(window).resize(function(){
"use strict";
if(jQuery(window).width()!=width){
jQuery('#mobile_menu').hide('10');
}});
Number.prototype.format=function(n, x){
var re='\\d(?=(\\d{' + (x||3) + '})+' + (n > 0 ? '\\.':'$') + ')';
return this.toFixed(Math.max(0, ~~n)).replace(new RegExp(re, 'g'), '$&'+control_vars.price_separator);
};
jQuery(document).ready(function ($){
"use strict";
var screen_width,screen_height;
$('.list_sidebar_currency li').click(function(){
var ajaxurl,data,pos,symbol,coef,curpos;
data=$(this).attr('data-value');
pos=$(this).attr('data-pos');
symbol=$(this).attr('data-symbol');
coef=$(this).attr('data-coef');
curpos=$(this).attr('data-curpos');
ajaxurl=ajaxcalls_vars.admin_url + 'admin-ajax.php';
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_set_cookie_multiple_curr',
'curr':data,
'pos':pos,
'symbol':symbol,
'coef':coef,
'curpos':curpos,
},
success: function (data){
location.reload();
},
error: function (errorThrown){}});
});
$('#map-view').click(function(event){
$('.map-type').fadeIn(400);
});
$('.map-type').click(function(){
var map_type;
$('.map-type').hide();
map_type=$(this).attr('id');
});
if(typeof enable_half_map_pin_action=='function'){
enable_half_map_pin_action();
}
$('#pack_select').change(function(){
var stripe_pack_id,stripe_ammount,the_pick;
$("#pack_select option:selected").each(function(){
stripe_pack_id=$(this).val();
stripe_ammount=parseFloat($(this).attr('data-price'))*100;
the_pick=$(this).attr('data-pick');
});
$('#pack_id').val(stripe_pack_id);
$('#pay_ammout').val(stripe_ammount);
$('#stripe_form').attr('data-amount',stripe_ammount);
$('.stripe_buttons').each(function(){
$(this).hide();
if($(this).attr('id')===the_pick){
$(this).show();
}})
});
$('#pack_recuring').click(function (){
if($(this).attr('checked')){
$('#stripe_form').append('');
}else{
$('#stripe_recuring').remove();
}});
$('.front_plan_row').click(function(event){
event.preventDefault();
$('.front_plan_row_image').slideUp();
$(this).next().slideDown();
})
$('.deleter_floor').click(function(){
$(this).parent().remove();
})
$('#adv_extended_options_text_adv ').click(function(){
$('.adv-search-1.adv_extended_class').css('height','auto');
$('.adv_extended_class .adv1-holder').css('height','auto');
$(this).parent().find('.adv_extended_options_text').hide();
$(this).parent().find('.extended_search_check_wrapper').slideDown();
$(this).parent().find('#adv_extended_close_adv').show();
});
$('#adv_extended_close_adv').click(function(){
$(this).parent().parent().find('.extended_search_check_wrapper').slideUp();
$(this).hide();
$(this).parent().parent().find('.adv_extended_options_text').show();
$('.adv-search-1.adv_extended_class').removeAttr('style');
$('.adv_extended_class .adv1-holder').removeAttr('style');
});
$('#adv_extended_options_text_widget').click(function(){
$(this).parent().find('.adv_extended_options_text').hide();
$(this).parent().find('.extended_search_check_wrapper').slideDown();
$(this).parent().find('#adv_extended_close_widget').show();
});
$('#adv_extended_close_widget').click(function(){
$(this).parent().parent().find('.extended_search_check_wrapper').slideUp();
$(this).hide();
$(this).parent().parent().find('.adv_extended_options_text').show();
});
$('#adv_extended_options_text_short').click(function(){
$(this).parent().find('.adv_extended_options_text').hide();
$(this).parent().find('.extended_search_check_wrapper').slideDown();
$(this).parent().find('#adv_extended_close_short').show();
});
$('#adv_extended_close_short').click(function(){
$(this).parent().parent().find('.extended_search_check_wrapper').slideUp();
$(this).hide();
$(this).parent().parent().find('.adv_extended_options_text').show();
});
$('#adv_extended_options_text_mobile').click(function(){
$(this).parent().find('.adv_extended_options_text').hide();
$(this).parent().find('.extended_search_check_wrapper').slideDown();
$(this).parent().find('#adv_extended_close_mobile').show();
});
$('#adv_extended_close_mobile').click(function(){
$(this).parent().parent().find('.extended_search_check_wrapper').slideUp();
$(this).hide();
$(this).parent().parent().find('.adv_extended_options_text').show();
});
$('.nav-prev,.nav-next ').click(function(event){
event.preventDefault();
var link=$(this).find('a').attr('href');
window.open (link,'_self',false)
})
$('.featured_agent_details_wrapper, .agent-listing-img-wrapper').click(function(){
var newl=$(this).attr('data-link');
window.open (newl,'_self',false)
});
$('.see_my_list_featured').click(function(event){
event.stopPropagation();
});
$('.featured_cover').click(function(){
var newl=$(this).attr('data-link');
window.open (newl,'_self',false)
});
$('.agent_face').hover(function(){
$(this).find('.agent_face_details').fadeIn('500')
}, function(){
$(this).find('.agent_face_details').fadeOut('500')
}
);
$('.property_listing, .agent_unit, .blog_unit , .featured_widget_image').click(function(){
var link;
link=$(this).attr('data-link');
window.open(link, '_self');
});
$('.share_unit').click(function(event){
event.stopPropagation();
});
$('.related_blog_unit_image').click(function(){
var link;
link=$(this).attr('data-related-link');
window.open(link, '_self');
});
$('#user_menu_u').click(function(event){
if($('#user_menu_open').is(":visible")){
$('#user_menu_open').removeClass('iosfixed').fadeOut(400);
}else{
$('#user_menu_open').fadeIn(400);
}
event.stopPropagation();
});
$(document).click(function(event){
var clicka=event.target.id
if(!$('#'+clicka).parents('.topmenux').length){
$('#user_menu_open').removeClass('iosfixed').hide(400);
}});
jQuery('#imagelist i.fa-trash-o').click(function(){
var curent='';
jQuery(this).parent().remove();
jQuery('#imagelist .uploaded_images').each(function(){
curent=curent+','+jQuery(this).attr('data-imageid');
});
jQuery('#attachid').val(curent);
});
jQuery('#imagelist img').dblclick(function(){
jQuery('#imagelist .uploaded_images .thumber').each(function(){
jQuery(this).remove();
});
jQuery(this).parent().append('')
jQuery('#attachthumb').val(jQuery(this).parent().attr('data-imageid'));
});
$('#switch').click(function (){
$('.main_wrapper').toggleClass('wide');
});
$('#accordion_prop_addr, #accordion_prop_details, #accordion_prop_features').on('shown.bs.collapse', function (){
$(this).find('h4').removeClass('carusel_closed');
})
$('#accordion_prop_addr, #accordion_prop_details, #accordion_prop_features').on('hidden.bs.collapse', function (){
$(this).find('h4').addClass('carusel_closed');
})
var elems=['#adv-search-3', '#adv-search-1', '#advanced_search_shortcode', '#adv-search-2', '#advanced_search_shortcode_2', '.adv-search-mobile','.advanced_search_sidebar'];
$.each(elems, function(i, elem){
$(elem+' li').click(function (event){
event.preventDefault();
var pick, value, parent,parent_replace;
parent_replace='.filter_menu_trigger';
if(elem==='.advanced_search_sidebar'){
parent_replace='.sidebar_filter_menu';
}
pick=$(this).text();
value=$(this).attr('data-value');
parent=$(this).parent().parent();
parent.find(parent_replace).text(pick).append('').attr('data-value',value);
parent.find('input').val(value);
});
});
jQuery('#adv-search-1 li, #adv-search-3 li, .halfsearch input[type="checkbox"]').click(function (){
if(typeof (show_pins)!=="undefined"){
first_time_wpestate_show_inpage_ajax_half=1
show_pins();
}});
jQuery('#adv_rooms, #adv_bath, #price_low, #price_max, #adv-search-1 input[type=text], #adv-search-3 input[type=text]').change(function (){
if(typeof (show_pins)!=="undefined"){
first_time_wpestate_show_inpage_ajax_half=1
show_pins();
}});
function isFunction(possibleFunction){
return typeof(possibleFunction)===typeof(Function);
}
$('#showinpage,#showinpage_mobile').click(function (event){
event.preventDefault();
wpestate_show_inpage_ajax();
});
function wpestate_show_inpage_ajax(){
if($('#gmap-full').hasClass('spanselected')){
$('#gmap-full').trigger('click');
}
if(mapfunctions_vars.custom_search==='yes'){
custom_search_start_filtering_ajax(1);
}else{
start_filtering_ajax(1);
}}
$('#openmap').click(function(){
if($(this).find('i').hasClass('fa-angle-down')){
$(this).empty().append(''+control_vars.close_map);
if(control_vars.show_adv_search_map_close==='no'){
$('.search_wrapper').addClass('adv1_close');
adv_search_click();
}}else{
$(this).empty().append(''+control_vars.open_map);
}
new_open_close_map(2);
});
var wrap_h;
var map_h;
$('#gmap-full').click(function(){
if($('#gmap_wrapper').hasClass('fullmap')){
$('#google_map_prop_list_wrapper').removeClass('fullhalf');
$('#gmap_wrapper').removeClass('fullmap').css('height',wrap_h+'px');
$('#googleMap').removeClass('fullmap').css('height',map_h+'px');
$('#search_wrapper').removeClass('fullscreen_search');
$('#search_wrapper').removeClass('fullscreen_search_open');
$('.nav_wrapper').removeClass('hidden');
if(!$('#google_map_prop_list_wrapper').length){
$('.content_wrapper').show();
}
$('body,html').animate({
scrollTop: 0
}, "slow");
$('#openmap').show();
$(this).empty().append(''+control_vars.fullscreen).removeClass('spanselected');
$('#google_map_prop_list_wrapper').removeClass('fullscreen');
$('#google_map_prop_list_sidebar').removeClass('fullscreen');
}else{
$('#google_map_prop_list_wrapper').addClass('fullscreen');
$('#google_map_prop_list_sidebar').addClass('fullscreen');
$('#google_map_prop_list_wrapper').addClass('fullhalf');
wrap_h=$('#gmap_wrapper').outerHeight();
map_h=$('#googleMap').outerHeight();
$('#gmap_wrapper,#googleMap').css('height','100%').addClass('fullmap');
$('#search_wrapper').addClass('fullscreen_search');
$('.nav_wrapper').addClass('hidden');
if(!$('#google_map_prop_list_wrapper').length){
$('.content_wrapper').hide();
}
$('#openmap').hide();
$(this).empty().append(''+control_vars.default).addClass('spanselected');
}
google.maps.event.trigger(map, "resize");
});
$('#street-view').click(function(){
toggleStreetView();
});
$('#slider_enable_map').click(function(){
var cur_lat, cur_long, myLatLng;
$('#carousel-listing div').removeClass('slideron');
$('.vertical-wrapper,.verticalstatus ').hide();
$(this).addClass('slideron');
$('#googleMapSlider').show();
google.maps.event.trigger(map, "resize");
map.setOptions({draggable: true});
cur_lat=jQuery('#googleMapSlider').attr('data-cur_lat');
cur_long=jQuery('#googleMapSlider').attr('data-cur_long');
myLatLng=new google.maps.LatLng(cur_lat,cur_long);
map.setCenter(myLatLng);
map.panBy(10,-100);
panorama.setVisible(false);
$('#gmapzoomminus.smallslidecontrol').show();
$('#gmapzoomplus.smallslidecontrol').show();
});
$('#slider_enable_street').click(function(){
var cur_lat, cur_long, myLatLng;
$('#carousel-listing div').removeClass('slideron');
$('.vertical-wrapper,.verticalstatus ').hide();
$(this).addClass('slideron');
cur_lat=jQuery('#googleMapSlider').attr('data-cur_lat');
cur_long=jQuery('#googleMapSlider').attr('data-cur_long');
myLatLng=new google.maps.LatLng(cur_lat,cur_long);
$('#googleMapSlider').show();
panorama.setPosition(myLatLng);
panorama.setVisible(true);
$('#gmapzoomminus.smallslidecontrol').hide();
$('#gmapzoomplus.smallslidecontrol').hide();
});
$('#slider_enable_slider').click(function(){
$('#carousel-listing div').removeClass('slideron');
$(this).addClass('slideron');
$('.vertical-wrapper,.verticalstatus ').show();
$('#googleMapSlider').hide();
panorama.setVisible(false);
$('#gmapzoomminus.smallslidecontrol').hide();
$('#gmapzoomplus.smallslidecontrol').hide();
});
$('.caption-wrapper').click(function(){
$(this).toggleClass('closed');
$('.carusel-back').toggleClass('rowclosed');
$('.post-carusel .carousel-indicators').toggleClass('rowclosed');
});
$('#carousel-listing').on('slid.bs.carousel', function (){
if($(this).hasClass('carouselvertical')){
show_capture_vertical();
}else{
show_capture();
}
$('#carousel-listing div').removeClass('slideron');
$('#slider_enable_slider').addClass('slideron');
})
$('.carousel-round-indicators li').click(function(){
$('.carousel-round-indicators li').removeClass('active');
$(this).addClass('active');
});
$('.videoitem iframe').click(function(){
$('.estate_video_control').remove();
});
adv_search_click();
$('#adv-search-header-1').click(function(){
if(document.getElementById("adv_extended_options_text_adv")!==null){
$(this).parent().toggleClass('adv-search-1-close-extended');
}else{
$(this).parent().toggleClass('adv-search-1-close');
}});
$('#adv-search-header-3').click(function(){
$(this).parent().parent().toggleClass(' search_wrapper-close-extended');
});
$(".share_list, .icon-fav, .compare-action, .dashboad-tooltip").hover(function(){
$(this).tooltip('show') ;
}, function(){
$(this).tooltip('hide');
}
);
$('.share_list').click(function(event){
event.stopPropagation();
var sharediv=$(this).parent().find('.share_unit');
sharediv.toggle();
$(this).toggleClass('share_on');
})
$('.backtop').click(function(event){
event.preventDefault();
$('body,html').animate({
scrollTop: 0
}, "slow");
})
$('.contact-box ').click(function(event){
event.preventDefault();
$('.contactformwrapper').toggleClass('hidden');
contact_footer_starter();
});
$('#morg_compute').click(function(){
var intPayPer=0;
var intMthPay=0;
var intMthInt=0;
var intPerFin=0;
var intAmtFin=0;
var intIntRate=0;
var intAnnCost=0;
var intVal=0;
var salePrice=0;
salePrice=$('#sale_price').val();
intPerFin=$('#percent_down').val() / 100;
intAmtFin=salePrice - salePrice * intPerFin;
intPayPer=parseInt ($('#term_years').val(),10) * 12;
intIntRate=parseFloat ($('#interest_rate').val(),10);
intMthInt=intIntRate / (12 * 100);
intVal=raisePower(1 + intMthInt, -intPayPer);
intMthPay=intAmtFin * (intMthInt / (1 - intVal));
intAnnCost=intMthPay * 12;
$('#am_fin').html(""+control_vars.morg1+"
" + (Math.round(intAmtFin * 100)) / 100 + " ");
$('#morgage_pay').html(""+control_vars.morg2+"
" + (Math.round(intMthPay * 100)) / 100 + " ");
$('#anual_pay').html(""+control_vars.morg3+"
" + (Math.round(intAnnCost * 100)) / 100 + " ");
$('#morg_results').show();
$('.mortgage_calculator_div').css('height',532+'px');
});
$("#geolocation-button").hover(function (){
$('#tooltip-geolocation').fadeIn();
$('.tooltip').fadeOut("fast");
},
function (){
$('#tooltip-geolocation').fadeOut();
}
);
$('.extra_featured').change(function(){
var parent=$(this).parent();
var price_regular=parseFloat(parent.find('.submit-price-no').text(),10);
var price_featured=parseFloat(parent.find('.submit-price-featured').text(),10);
var total=price_regular+price_featured;
if($(this).is(':checked')){
parent.find('.submit-price-total').text(total);
parent.find('#stripe_form_featured').show();
parent.find('#stripe_form_simple').hide();
}else{
parent.find('.submit-price-total').text(price_regular);
parent.find('#stripe_form_featured').hide();
parent.find('#stripe_form_simple').show();
}});
$('.compare_wrapper').each(function(){
var cols=$(this).find('.compare_item_head').length;
$(this).addClass('compar-' + cols);
});
$('#list_view').click(function(){
$(this).toggleClass('icon_selected');
$('#listing_ajax_container').addClass('ajax12');
$('#grid_view').toggleClass('icon_selected');
$('.listing_wrapper').hide().removeClass('col-md-4').removeClass('col-md-3').addClass('col-md-12').fadeIn(400) ;
$('.the_grid_view').fadeOut(10,function(){
$('.the_list_view').fadeIn(300);
});
})
$('#grid_view').click(function(){
var class_type;
class_type=$('.listing_wrapper:first-of-type').attr('data-org');
$(this).toggleClass('icon_selected');
$('#listing_ajax_container').removeClass('ajax12');
$('#list_view').toggleClass('icon_selected');
$('.listing_wrapper ').hide().removeClass('col-md-12').addClass('col-md-'+class_type).fadeIn(400);
$('.the_list_view').fadeOut(10,function(){
$('.the_grid_view').fadeIn(300);
});
})
var already_in=[];
$('.compare-action').click(function(e){
e.preventDefault();
e.stopPropagation();
$('.prop-compare').show();
var post_id=$(this).attr('data-pid');
for(var i=0; i < already_in.length; i++){
if(already_in[i]===post_id){
return;
}}
already_in.push(post_id);
var post_image=$(this).attr('data-pimage');
var to_add='